package com.slfx.function.permission.controller;


import com.slfx.function.permission.entity.SystemUsers;
import com.slfx.function.permission.service.ISystemUsersService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 用户信息表 前端控制器
 * </p>
 *
 * @author slfx
 * @since 2023-01-02
 */
@RestController
@RequestMapping("/systemUsers")
public class SystemUsersController {

    @Resource
    private ISystemUsersService systemUsersService;

    /**
     * 根据ID获取
     *
     * @param id
     * @return
     */
    @GetMapping("/getById")
    public SystemUsers getById(@RequestParam("id") Long id) {
        SystemUsers users = systemUsersService.getById(id);
        return users;
    }

    /**
     * 新增
     *
     * @param users
     * @return
     */
    @PostMapping("/save")
    public Long save(@RequestBody SystemUsers users) {
        systemUsersService.save(users);
        return users.getId();
    }
}
